<?php

/**
 * Description of GlobalAction
 *
 * @author Administrator
 */
class GlobalAction extends PublicAction {

    /** 系统配置 - 站点配置 * */
    //站点设置
    public function siteopt() {
        $site_opt = D('Xdata')->lget('siteopt');
        $this->assign($site_opt);

//        require_once ADDON_PATH . '/libs/Io/Dir.class.php';
//        $theme_list = new Dir(SITE_PATH . '/public/themes/');
//        $this->assign('theme_list', $theme_list->toArray());
        $this->display();
    }

    //设置站点
    public function doSetSiteOpt() {
        if (empty($_POST)) {
            $this->error('参数错误');
        }

        $_POST['site_name'] = $_POST['site_name'];
        $_POST['site_slogan'] = $_POST['site_slogan'];
        $_POST['site_header_keywords'] = $_POST['site_header_keywords'];
        $_POST['site_header_description'] = $_POST['site_header_description'];
        $_POST['site_closed'] = intval($_POST['site_closed']);
        $_POST['site_closed_reason'] = $_POST['site_closed_reason'];
        $_POST['site_icp'] = $_POST['site_icp'];
        $_POST['site_verify'] = isset($_POST['site_verify']) ? $_POST['site_verify'] : '';

        $res = D('Xdata')->lput('siteopt', $_POST);
        if ($res) {
            $this->assign('jumpUrl', U('Global/siteopt'));
            $this->success('保存成功');
        } else {
            $this->error('保存失败');
        }
    }

}

?>
